package com.ericom.dao.hibernate;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ericom.dao.AuctionDao;
import com.ericom.model.Auction;
@Repository("auctionDao")
public class AuctionDaoHiberante extends GenericDaoHibernate<Auction, Long> implements
		AuctionDao {

	

	public AuctionDaoHiberante() {
		super(Auction.class);

	}

	@Override
	public List<Auction> findAuctionByStatus(String status) {
		return this.getHibernateTemplate().find("from Auction where status=?",status);
	}

	@Override
	public List<Auction> findAuctionByValideDate(String valideDate) {
		Object[] dateRange=new Object[]{valideDate,valideDate};
		return this.getHibernateTemplate().find("from Auction where valideFrom<=? and valideTo>=?", dateRange);
		
	}

}
